package com.demo.component;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-05-26
 * Time:23:09
 */
@Component
public class BeanLifeComponent implements BeanNameAware {

    @Override
    public void setBeanName(String s) {
        System.out.println("执行了通知方法");
    }

    @PostConstruct
    public void postConstruct(){
        System.out.println("执行了postConstruct");
    }

    public void Init(){
        System.out.println("执行了 init-method 方法");
    }

    @PreDestroy
    public void preDestroy(){
        System.out.println("执行销毁方法");
    }
}
